<?php
/**
 * Created by PhpStorm.
 * User: gogo
 * Date: 2018/6/28
 * Time: 下午9:24
 */
namespace app\tools;

class RedisCache extends \Redis
{
    // 实例
    protected static $_instance = null;

    public static function getInstance($db = 0){
        if (null === self::$_instance) {

            self::$_instance = new self();
            self::$_instance->connect('127.0.0.1', 6379);
            self::$_instance->auth('Lxj0923814');
            self::$_instance->select($db);
        }
        return self::$_instance;
    }
}